/*
package cn.onlineclass.servlet;

import cn.school.entity.Admin;
import cn.school.service.AdminService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/loginServlet")
public class LoginServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=utf-8");
        //String code = request.getParameter("code");
        String aname = request.getParameter("aname");
        System.out.println(aname+"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
        String apass = request.getParameter("apass");
        Admin admin = AdminService.ADMIN.find(aname, apass);
        System.out.println(admin+">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
       */
/* if (!code.equals((String) request.getSession().getAttribute("code"))){
            request.getSession().setAttribute("msg", "<script>alert('您的验证码有误!!!')</script>");
            response.sendRedirect("/login.jsp");
        }else*//*
 if (admin!=null){
              */
/*  Cookie cookie = new Cookie("name", aname);
                Cookie cookie1 = new Cookie("pass", apass);
                cookie.setMaxAge(60 * 60 * 24 * 7);
                cookie1.setMaxAge(60 * 60 * 24 * 7);
                response.addCookie(cookie);
                response.addCookie(cookie1);*//*

                request.getSession().setAttribute("USER_LOGIN",aname);
                response.sendRedirect("index.jsp");
                return;
            }
        request.setAttribute("msg","输入用户名或密码错误!");
        request.getRequestDispatcher("/login.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request,response);
    }
}
*/
